package IOperation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-01-02
 * Time: 20:15
 */
public class AddOperation implements Operation{
    @Override
    public void work(BookList bookList) {
        System.out.println("*****新增图书*****");
        System.out.println("请输入新增的书名:");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        System.out.println("请输入作者:");
        String author=scanner.nextLine();
        System.out.println("请输入类型");
        String type=scanner.nextLine();
        System.out.println("请输入价格");
        int price=scanner.nextInt();
         Book book=new Book(name,author,price,type);
         int size=bookList.getUseSize();
         bookList.setBook(size,book);
         bookList.setUseSize(size+1);
        System.out.println("新增成功,以下是该书的信息");
        System.out.println(book);


    }
}
